package com.eagle.security.dao;

import java.util.List;
import java.util.Map;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.provisioning.UserDetailsManager;

import com.eagle.security.entries.User;
import com.eagle.security.entries.UserCopy;


public interface UserDetailsDao extends UserDetailsManager {
    //-------------------------------------from UserDetailsManager ------------------
    /**
     * 新增用户
     * Create a new user with the supplied details.
     */
    void createUser(UserDetails user);

    /**
     * 修改用户信息
     * Update the specified user.
     */
    void updateUser(UserDetails user);

    /**
     * 根据用户名，删除用户
     * Remove the user with the given login name from the system.
     */
    void deleteUser(String username);

    /**
     * 修改用户密码
     * 
     * Modify the current user's password. This should change the user's password in
     * the persistent user repository (datbase, LDAP etc).
     *
     * @param oldPassword current password (for re-authentication if required)
     * @param newPassword the password to change to
     */
    void changePassword(String oldPassword, String newPassword);

    /**
     * 检查用户是否存在
     * Check if a user with the supplied login name exists in the system.
     */
    boolean userExists(String username);
    
  //------------------------------------- self --------------------------------
    
    /**
     * find
     * 
     * @param id
     * @return
     */
    User findUserByUsername(String username );

    /**
     * find
     * 
     * @param id
     * @return
     */
    Map<String, Object> findUserMapByUsername(String username );

    /**
     * 根据条件查找
     * 
     * @param mo
     * @param start
     * @param pageSize
     * @return
     */
    List<User> findUsersByCond(User mo, int start, int pageSize);

    /**
     * 根据条件查找
     * 
     * @param mo
     * @param start
     * @param pageSize
     * @return
     */
    List<Map<String, Object>> findUserMapsByCond(User mo, int start, int pageSize);

    /**
     * 根据条件查找总数
     * 
     * @param mo
     * @return
     */
    int findUserCountByCond(User mo);



    
}
